﻿///////////////////////////////////////////////////////
//
// XDesigner.ORM 
//
// autohr : yuans
//
// date: 2011-2-23
//
// email  : yyf9989@hotmail.com
// 
//
///////////////////////////////////////////////////////

using System;
using System.Collections.Generic;
using System.Text;
using XDesigner.ORM;
using System.ComponentModel;

namespace XDesigner.ORM.DOM
{
    [Serializable()]
    [System.ComponentModel.TypeConverter( typeof( ORMIDGenerateInfoTypeConver ))]
    public class ORMNewValueGenerateInfo : ICloneable
    {
        public ORMNewValueGenerateInfo()
        {
        }

        private ORMNewValueGenerateStyle _Style = ORMNewValueGenerateStyle.None ;
        [DefaultValue( ORMNewValueGenerateStyle.None )]
        public ORMNewValueGenerateStyle Style
        {
            get { return _Style; }
            set { _Style = value; }
        }

        private string _Format = null;
        [DefaultValue(null)]
        public string Format
        {
            get { return _Format; }
            set { _Format = value; }
        }

        public ORMNewValueGenerateInfo Clone()
        {
            return (ORMNewValueGenerateInfo)((ICloneable)this).Clone();
        }

        object ICloneable.Clone()
        {
            ORMNewValueGenerateInfo info = new ORMNewValueGenerateInfo();
            info._Format = this._Format;
            info._Style = this._Style;
            return info;
        }

    }

    public class ORMIDGenerateInfoTypeConver : System.ComponentModel.TypeConverter
    {
        public override bool GetPropertiesSupported(ITypeDescriptorContext context)
        {
            return true;
        }
        public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes)
        {
            return TypeDescriptor.GetProperties(typeof(ORMNewValueGenerateInfo), attributes);
        }
    }
}
